//1、导入koa包
const Koa = require('koa');
//2、实例化app对象
const app = new Koa();
//3、编写中间件
app.use( async(ctx,next) => {
    ctx.message='aa'
    await next();
    ctx.body = ctx.message;
})
app.use(async (ctx,next) => {
    ctx.message+='bb'
    await next();
})
app.use(async (ctx,next) => {
    const res=await Promise.resolve('cc')
    ctx.message+=res
})
//4、启动服务，监听3000端口
app.listen(3000, () => {
    console.log('koa服务器启动成功~');
})